<?php 
	require_once("../config/db.php");
	require_once('../model/Battleground.php');

	$jsonObj = $_GET['json'];
	$x = $_GET['x'];
	$y = $_GET['y'];
	$size = $_GET['size'];
	$idShip = $_GET['idShip'];

	$bg = new Battleground($jsonObj['idGame'], $jsonObj['idP1'], $jsonObj['idP2'], 0);
	$id = $bg->__get('idP'.$_GET['player']);
	$posValide = $bg->positionBattleship($id, $jsonObj['idGame'], $size, $x, $y);
	$posValide['player'] = $id ;
	$posValide['idShip'] = $idShip ;

	header("Content-type: application/json");
	echo json_encode($posValide);

?>